package com.doge.bean.vo.role;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @program: doge
 * @description:
 * @author: Keyu Li
 * @create: 2021-11-30 09:32
 **/


@NoArgsConstructor
@Data
public class PermissionVO {

    @JsonProperty("systemPermissions")
    private List<SystemPermission> systemPermissions;
    @JsonProperty("assignedPermissions")
    private List<String> assignedPermissions;

    @NoArgsConstructor
    @Data
    public static class SystemPermission {
        /*
        * id 和 label 是一样的
        * */
        @JsonProperty("id")
        private String id;
        @JsonProperty("label")
        private String label;
        @JsonProperty("children")
        private List<ControllerLabel> children;

        @NoArgsConstructor
        @Data
        public static class ControllerLabel {
            /*
            * id 和 label 是一样的
            * */
            @JsonProperty("id")
            private String id;
            @JsonProperty("label")
            private String label;
            @JsonProperty("children")
            private List<FuncLabel> children;

            @NoArgsConstructor
            @Data
            public static class FuncLabel {
                /*
                * id 是 permission，api是 url-pattern
                * */
                @JsonProperty("id")
                private String id;
                @JsonProperty("label")
                private String label;
                @JsonProperty("api")
                private String api;
            }
        }
    }
}
